#pragma strict
//////////////////////////////////////////////////////
///模型导入后,在模型的同目录建立一Prefab.
//////////////////////////////////////////////////////
import System.IO;
import System.Collections.Generic;

class GenPrefabPostprocessor extends AssetPostprocessor{
	function OnPreprocessModel(){
		
	}
	function OnPostprocessModel(go:GameObject){
		// if(go.name.Contains("@"))
			// GeneratePrefab(go);
	}
	
	/**
		生成 对于的prefab
	*/
	function GeneratePrefab(go:GameObject){
		var dirPath:String = Directory.GetParent(assetPath).ToString();
		var path:String = dirPath+"/" + go.name + ".prefab";
		var prefab:UnityEngine.Object = PrefabUtility.CreateEmptyPrefab(path);
		
		PrefabUtility.ReplacePrefab(go,prefab);
		AssetDatabase.Refresh();
	}
}